package com.comum.javahomework420242025.pojo;

import com.comum.javahomework420242025.utils.LocalDateTimeDeserializer;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;


@NoArgsConstructor
@AllArgsConstructor
@Data
@Entity
@Table(name = "approval")
public class Approval {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Long id;



    @Column(name = "contractid")
    private Long contractid;


    //员工id
    @Column(name = "userid")
    private Long userid;


    @Column(name = "nodes", length = 255)
    private String nodes;


    @Column(name = "phase", length = 255)
    private String phase;

    @Column(name = "sjjd", length = 255, nullable = true)
    private String sjjd;

    @Column(name = "scjd", length = 255, nullable = true)
    private String scjd;
    @Column(name = "zzjd", length = 255, nullable = true)
    private String zzjd;
    @Column(name = "zpjd", length = 255, nullable = true)
    private String zpjd;
    @Column(name = "cgjd", length = 255, nullable = true)
    private String cgjd;

    @Column(name = "actiontime")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") // 指定 JSON 输出的格式
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime actiontime;

    @ManyToOne
    @JoinColumn(name = "userid", insertable = false, updatable = false)
    private User user;

    @ManyToOne
    @JoinColumn(name = "contractid", insertable = false, updatable = false)
    private Contract contract;
}
